function getSub(arr = []) {
    let arrJson = [];
    for (let i = 0; i < arr.length; i++) {
        if (arrJson.length == 0) {
            arrJson.push([arr[i]]);
        } else {
            let minStart = arrJson[0][0];
            if (minStart > arr[i]) {
                arrJson.unshift([arr[i]])
            } else {
                var arrD = []
                for (let j = 0; j < arrJson.length; j++) {
                    let newItem = insertJson(arrJson[j], arr[i]);
                    if (newItem) {
                        arrD.push(newItem);
                    }
                }
                arrJson = arrJson.concat(arrD);
            }
        }
    }
    return arrJson;
}
function insertJson(obj = [], item) {
    let index = obj.findIndex(e => e == item);
    if (index >= 0) {
        return null
    }
    index = obj.findIndex(e => e > item);
    if (index < 0) {
        obj.push(item);
    } else {
        let arrNew = obj.slice(0, index);
        arrNew.push(item);
        return arrNew;
    }
}

function getMaxSubLength(arr = []) {
    return Math.max(...arr.map(e => {
        return e.length;
    }))
}
let ar = getSub([12, 14, 15, 0, 2, 3, 7, 5, 6, 12, 9,])
console.log(ar);
console.log(getMaxSubLength(ar));